using System.Linq;
using Gw2Api;

namespace Gw2WvWMapControl
{
    public class Util
    {

        public static string GetWorldName(WvWApi api, string matchupId, string color)
        {
            WorldNameApi names = Gw2ApiFactory.WorldNameApi;
            WvWMatch match = api.GetMatchupsV2().First(m => m.id == matchupId);
            switch (color.ToLower())
            {
                case "red":
                    return names.GetWorldFromId(match.worlds[WvWMatch.WvWTeam.red].ToString());
                case "blue":
                    return names.GetWorldFromId(match.worlds[WvWMatch.WvWTeam.blue].ToString());
                case "green":
                    return names.GetWorldFromId(match.worlds[WvWMatch.WvWTeam.green].ToString());
            }
            return "";
        }
    }
}